<template>
	<uni-card>
		<uni-row>
			<uni-col :span="12">
				<view  style="line-height: 2;">
					<uni-row>姓名：{{ student.studentName }}</uni-row>
					<uni-row>班级：{{ student.className }}</uni-row>
					<uni-row>宿舍：{{ student.dormitoryNo }}</uni-row>
					<uni-row>日期：{{ rq }}</uni-row>
				</view>
			</uni-col>
			
			<uni-col :span="10" :offset="2">
				<image style="width: 100px;height: 100px;" :src="stuPhoto" @click="imgClick"></image>
			</uni-col>
		</uni-row>
		
		<view class="container">
			<button :type="classType">{{status}}</button>
		</view>
		
	</uni-card>
</template>

<script>
	import studentWork from "@/api/modules/studentWork.js"
	import { parseTime } from "@/utils/date.js"
	
	export default {
		mounted() {
			studentWork.getLeavingSchoolCertificate(uni.getStorageSync("loginId")).then(res=> {
				this.student = res.data;
				this.stuPhoto = res.data.stuPhoto ? res.data.stuPhoto : 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/boy.png';
				if(res.data.status) {
					this.status = '通过'
					this.classType = 'primary'
				}else {
					this.status = '未通过'
					this.classType = 'warn'
				}
			})
		},
		data() {
			return {
				student: {},
				stuPhoto: '',
				rq : parseTime(Date.now()).slice(0, 10),
				status : '',
				classType: '',
			}
		},
		methods: {
			//照片预览
			imgClick() {
				uni.previewImage({
					current: 0,
					urls: [this.stuPhoto]
				})
			}
		}
	}
</script>

<style>
</style>
